package com.example.juc;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @Description
 * @Date 2021/7/23
 * @Created by Jonathan
 */
@Slf4j
public class Demo02_Visible {
    // 易变
    static /*volatile*/ boolean run = true;
    static final Object lock = new Object();

    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            while (run) {
                int num = 3;
                //System.out.println(num);
            }
        }).start();

        TimeUnit.SECONDS.sleep(1);
        run = false;
    }
}
